package com.af.community.smart.business

import android.os.Bundle
import android.view.View
import com.af.community.smart.base.BaseActivity
import com.af.community.smart.utils.CaptchaHelper
import com.af.community.smart.utils.dp2px
import kotlinx.android.synthetic.main.activity_handle_tax.*
import org.jetbrains.anko.startActivity

class HandleTaxActivity : BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_handle_tax)
        setTransparentAndToolbar(isDarkFont = false)
        initTitle()
    }

    override fun initTitle(title: String, name: String) {
        setCodeImage()
    }

    override fun doClick(v: View) {
        super.doClick(v)
        when (v.id) {
            R.id.tax_img -> setCodeImage()
            R.id.bt_check -> startActivity<HandleTaxResultActivity>()
        }
    }

    private fun setCodeImage() {
        CaptchaHelper.build()
            .codeLength(4)
            .size(dp2px(60f), dp2px(25f))
            .lineNumber(10)
            .into(tax_img)
    }

}
